package org.example.ref;

import java.util.Scanner;

public class UI1 {
    public void mainOrder() {
        System.out.println("---------------------主菜单-------------------------");
        System.out.println("---------------------1.登录-------------------------");
        System.out.println("---------------------2.退出-------------------------");
        System.out.println("---------------------3.下载-------------------------");
        System.out.println("---------------------4.上传-------------------------");
    }

    public void downLoad() {
        System.out.println("---------------------1.直接下载-------------------------");
        System.out.println("---------------------2.切换下载目录-------------------------");
    }

    public void upLoad() {
        System.out.println("---------------------1.直接上传-------------------------");
        System.out.println("---------------------2.切换上传目录-------------------------");
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        UI1 ui = new UI1();
        int choose = 0;
        while (choose != 2) {
            ui.mainOrder();
            System.out.println("请输入你的选择");
            choose = scanner.nextInt();
            switch (choose) {
                case 1:
                    System.out.println("你选择了登录功能");
                    break;
                case 2:
                    System.out.println("你选择了退出功能");
                    char notarize = '0';
                    boolean isTrue = true;
                    do {
                        System.out.println("请确认是否退出(Y or N)");
                        notarize = scanner.next().charAt(0);
                        if (notarize == 'Y') {
                            System.out.println("退出成功");
                            isTrue = false;
                        }
                        if (notarize == 'N') {
                            System.out.println("您已经取消退出");
                            isTrue = false;
                        }
                    }
                    while (isTrue);
                    break;
                case 3:
                    int downChoose = 0;
                    while (downChoose != 2 && downChoose != 1) {
                        ui.downLoad();
                        System.out.println("请输入你的选择");
                        downChoose = scanner.nextInt();
                        if (downChoose == 1) {
                            System.out.println("下载成功");
                        }
                        if (downChoose == 2) {
                            String absolutePath = "o";
                            System.out.println("你已选则切换下载目录");
                            System.out.println("请输入该目录的绝对路径");
                            absolutePath = scanner.next();
                            System.out.println(absolutePath);
                        }
                    }
                    break;
                case 4:
                    int upChoose = 0;
                    while (upChoose != 2 && upChoose != 1) {
                        ui.upLoad();
                        System.out.println("请输入你的选择");
                        upChoose = scanner.nextInt();
                        if (upChoose == 1) {
                            System.out.println("下载成功");
                        }
                        if (upChoose == 2) {
                            String absolutePath = "o";
                            System.out.println("你已选则切换下载目录");
                            System.out.println("请输入该目录的绝对路径");
                            absolutePath = scanner.next();
                            System.out.println(absolutePath);

                        }
                    }
                    break;
                default:
                    System.out.println("错误选择");
                    break;

            }
        }

    }
}
